var e = getApp(), r = (require("../../../data/mockData.js"), wx.getStorageSync("user"), 
wx.getStorageSync("order"), wx.getStorageSync("coupon"), wx.getStorageSync("driver"), 
wx.getStorageSync("evaluate"), wx.getStorageSync("server"), require("../../../utils/function.js")), a = require("../../../api.js");

Page({
    data: {
        order: wx.getStorageSync("orderDetail"),
        driver: {},
        order_no: "",
        is_pay: 0
    },
    onLoad: function(r) {
        this.setData({
            order_no: r.order_no
        }), r.uid && e.shareCouponsMessage(r.uid);
    },
    onReady: function() {},
    onShow: function() {
        var r = this;
        e.request({
            url: a.order.order_detail,
            method: "post",
            data: {
                order_no: r.data.order_no
            },
            success: function(e) {
                var a = e.data;
                a.orderdetail.actual_price = Number(a.orderdetail.actual_price), a.orderdetail.float_price = Number(a.orderdetail.float_price), 
                1 == e.code && r.setData({
                    order: a,
                    phone: a.driver.work_phone,
                    is_pay: a.orderdetail.is_pay
                });
            }
        });
    },
    skipPageHandler: function(e) {
        if (0 == this.data.is_pay && 0 == this.data.order.orderdetail.apply_delete) wx.showToast({
            title: "该订单还未完成",
            icon: "none",
            duration: 2e3
        }); else {
            if (1 == this.data.order.orderdetail.apply_delete) return void wx.showToast({
                title: "该订单已取消",
                icon: "none",
                duration: 2e3
            });
            wx.navigateTo({
                url: e.currentTarget.dataset.skip
            });
        }
    },
    callPhoneHandler: function() {
        r.callPhoneHandler(this.data.phone);
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {
        return {
            title: e.shareAppMessage().title,
            imageUrl: e.shareAppMessage().imageUrl,
            desc: e.shareAppMessage().desc,
            path: e.shareAppMessage().path
        };
    }
});